﻿<%@ Page Title="" Language="C#" MasterPageFile="~/OfficeMasterPage.Master" AutoEventWireup="true"
    CodeBehind="frmTipoProduto.aspx.cs" Inherits="EstoqueUnifeiADO.frmTipoProduto" %>

<asp:Content ID="Content1" ContentPlaceHolderID="HeadContent" runat="server">
    <style type="text/css">
        
    </style>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="MainContent" runat="server">
    <asp:UpdatePanel ID="UpdatePanel3" runat="server">
        <ContentTemplate>
            <asp:ValidationSummary ID="vsform" runat="server" BorderColor="Red" 
                BorderStyle="Solid" BorderWidth="2px" ForeColor="Red" />
        </ContentTemplate>
    </asp:UpdatePanel>
    <table style="width: 98%">
        <tr>
            <td style="width: 50%">
                <asp:ObjectDataSource ID="odsView" runat="server" OldValuesParameterFormatString="original_{0}"
                    SelectMethod="GetData" TypeName="EstoqueUnifeiADO.Dados.dsTipoProdutoTableAdapters.TIPOTableAdapter">
                </asp:ObjectDataSource>
                <div style="background-color: white">
                    <asp:ImageButton ID="ImageButton1" runat="server" ImageUrl="~/images/Icones/treeAddRoot.png"
                        BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" ToolTip="Adicionar elemento raiz"
                        ImageAlign="Middle" OnClick="AdicionarRaiz" />
                    <asp:ImageButton ID="ImageButton2" runat="server" ImageUrl="~/images/Icones/treeAddChild.png"
                        BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" ToolTip="Adicionar elemento filho"
                        ImageAlign="Middle" OnClick="AdicionarFilho" />
                    <asp:ImageButton ID="ImageButton3" runat="server" ImageUrl="~/images/Icones/treedeleteItem.png"
                        BorderColor="Black" BorderStyle="Solid" BorderWidth="1px" ToolTip="Excluir elemento"
                        ImageAlign="Middle" OnClick="ExcluirNo" />
                    <asp:UpdatePanel ID="UpdatePanel2" runat="server">
                        <ContentTemplate>
                            <asp:TreeView ID="trvTipo" runat="server" BorderColor="Black" BorderStyle="Solid"
                                BorderWidth="1px" ImageSet="XPFileExplorer" OnSelectedNodeChanged="trvTipo_SelectedNodeChanged"
                                Width="98%" NodeIndent="15">
                                <HoverNodeStyle Font-Underline="True" ForeColor="#6666AA" />
                                <NodeStyle Font-Names="Tahoma" Font-Size="8pt" ForeColor="Black" HorizontalPadding="2px"
                                    NodeSpacing="0px" VerticalPadding="2px" />
                                <ParentNodeStyle Font-Bold="False" />
                                <SelectedNodeStyle BackColor="#B5B5B5" Font-Underline="False" HorizontalPadding="0px"
                                    VerticalPadding="0px" />
                            </asp:TreeView>
                        </ContentTemplate>
                    </asp:UpdatePanel>
                </div>
            </td>
            <td>
                <asp:ObjectDataSource ID="odsItem" runat="server" DeleteMethod="Delete" InsertMethod="Insert"
                    OldValuesParameterFormatString="original_{0}" SelectMethod="GetDataByID" TypeName="EstoqueUnifeiADO.Dados.dsTipoProdutoTableAdapters.TIPOTableAdapter"
                    UpdateMethod="UptCustom">
                    <DeleteParameters>
                        <asp:Parameter Name="Original_CODTIPO" Type="Int32" />
                    </DeleteParameters>
                    <InsertParameters>
                        <asp:Parameter Name="TIPODESCRICAO" Type="String" />
                        <asp:ControlParameter ControlID="hfParent" Name="PARENT" PropertyName="Value" Type="String" />
                    </InsertParameters>
                    <SelectParameters>
                        <asp:ControlParameter ControlID="hfKey" Name="CODTIPO" PropertyName="Value" Type="Int32" />
                    </SelectParameters>
                    <UpdateParameters>
                        <asp:Parameter Name="TIPODESCRICAO" Type="String" />
                        <asp:Parameter Name="Original_CODTIPO" Type="Int32" />
                    </UpdateParameters>
                </asp:ObjectDataSource>
                <asp:UpdatePanel ID="UpdatePanel1" runat="server">
                    <ContentTemplate>
                        <asp:HiddenField ID="hfKey" runat="server" />
                        <asp:HiddenField ID="hfParent" runat="server" />
                        <asp:FormView ID="fvTipo" runat="server" DataKeyNames="CODTIPO" DataSourceID="odsItem"
                            Width="98%" OnItemDeleted="fvTipo_ItemDeleted" OnItemInserted="fvTipo_ItemInserted"
                            OnDataBound="fvTipo_DataBound" OnItemUpdated="fvTipo_ItemUpdated">
                            <EditItemTemplate>
                                Código do tipo:<br />
                                <asp:TextBox ID="TIPOCODIGOTextBox" runat="server" Width="98%" Text='<%# Eval("TIPOCODIGO") %>'
                                    Enabled="false" />
                                <br />
                                Descrição do tipo:<br />
                                <asp:TextBox ID="TIPODESCRICAOTextBox" runat="server" Width="98%" Text='<%# Bind("TIPODESCRICAO") %>' />
                                <asp:RequiredFieldValidator ID="RequiredFieldValidator1" runat="server" ErrorMessage="Campo obrigatório"
                                    ControlToValidate="TIPODESCRICAOTextBox"></asp:RequiredFieldValidator>
                                <br />
                                <asp:LinkButton ID="UpdateButton" runat="server" CausesValidation="True" CommandName="Update"
                                    Text="Update" />
                                &nbsp;<asp:LinkButton ID="UpdateCancelButton" runat="server" CausesValidation="False"
                                    CommandName="Cancel" Text="Cancel" />
                            </EditItemTemplate>
                            <InsertItemTemplate>
                                Descrição do tipo:
                                <asp:TextBox ID="TIPODESCRICAOTextBox" runat="server" Text='<%# Bind("TIPODESCRICAO") %>'
                                    Width="98%" /><asp:RequiredFieldValidator ID="RequiredFieldValidator2" runat="server"
                                        ErrorMessage="Campo obrigatório" ControlToValidate="TIPODESCRICAOTextBox"></asp:RequiredFieldValidator>
                                <br />
                                <asp:LinkButton ID="InsertButton" runat="server" CausesValidation="True" CommandName="Insert"
                                    Text="Insert" />
                                &nbsp;<asp:LinkButton ID="InsertCancelButton" runat="server" CausesValidation="False"
                                    CommandName="Cancel" Text="Cancel" />
                            </InsertItemTemplate>
                            <ItemTemplate>
                                Tipo código:<br />
                                <asp:TextBox ID="TIPOCODIGOLabel" runat="server" Text='<%# Bind("TIPOCODIGO") %>'
                                    Enabled="false" Width="98%" />
                                <br />
                                Descrição:<br />
                                <asp:TextBox ID="TIPODESCRICAOLabel" runat="server" Text='<%# Bind("TIPODESCRICAO") %>'
                                    Enabled="false" Width="98%" />
                                <br />
                                <asp:LinkButton ID="EditButton" runat="server" CausesValidation="false" CommandName="Edit"
                                    Text="Alterar" />
                            </ItemTemplate>
                        </asp:FormView>
                    </ContentTemplate>
                </asp:UpdatePanel>
            </td>
        </tr>
    </table>
</asp:Content>
